package cn.getech.data.development.service;

import cn.getech.data.development.entity.BdpUdfJarInfo;
import cn.getech.data.development.entity.JobRunUdf;
import cn.getech.data.development.entity.ProcInfo;
import cn.getech.data.development.model.dto.JobRunUdfDto;
import cn.getech.data.development.model.req.procinfo.ProcInfoListOwerReq;
import cn.getech.data.development.model.res.procinfo.ProcInfoListRes;
import cn.getech.data.development.model.vo.UdfJarPropertyVo;
import cn.getech.data.intelligence.common.utils.PageUtils;
import cn.getech.data.intelligence.common.utils.PageUtils2;
import com.baomidou.mybatisplus.extension.service.IService;
import org.springframework.web.multipart.MultipartFile;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 项目信息表 服务类
 * </p>
 *
 * @author zenith
 * @since 2018-08-21
 */
public interface ProcInfoService extends IService<ProcInfo> {
    boolean isProcOwer(Long userId, Long procId);

    PageUtils selectListPage(Map<String, Object> params);
    List<Map<String,Integer>> connectTypes(Integer procId);
    List<Map<String,Object>> tableTypes(Integer procId);
    List<Map<String,String>> jobAlerts(Integer procId);
    List<Map<String,Object>> last1Hour(Integer procId);
    List<Map<String,Object>> last6Hour(Integer procId);
    List<Map<String,Object>> last1Day(Integer procId);
    List<Map<String,Object>> last1Week(Integer procId);
    List<Map<String,Object>> last1Month(Integer procId);

    boolean checkIfRef(Integer procId);
    /**
    * @Description  验证项目表名称是否重复
    * @Author  hujz
    * @Date   2019/8/8 14:24
    * @Param  procInfo 待验证的参数
    * @Return 是否重复
    * @Exception  true：有重复的  false：无重复的名称
    *
    */
    boolean checkExistByName(ProcInfo procInfo);
    boolean checkPermission(Integer procId);
    boolean checkExistById(Integer procId);


    Map<String,Boolean>  getJarDetials(MultipartFile multipartFile, int procId) throws Exception;

    void registUdf(UdfJarPropertyVo udfJarPropertyVo,BdpUdfJarInfo bdpUdfJarInfo) throws SQLException;

    List<JobRunUdf> getProcUdfFuncs(Integer procId,Integer jarId);

    PageUtils getProcUdfFuncsByPage(Map<String, Object> params);

    void deleteUdfFunc(Integer id,Integer userId,Boolean dbDataDelete);


    void deleteUdfJar(BdpUdfJarInfo bdpUdfJarInfo);

    List<ProcInfo> listUserProcs(Long userId);

    List<ProcInfo> listUserProcsByTenantId(Long userId, Integer tenantId);

    PageUtils2<ProcInfoListRes> listOwer(ProcInfoListOwerReq req, Long userId);

    PageUtils listUser(Map<String, Object> params);

    List<JobRunUdfDto> listUdfFuncs();

    List<ProcInfo>   getAllProcList();

    List<ProcInfo> procs(Integer type);

    List<ProcInfo> logProcs(Integer type);

    List<ProcInfo> seeList();

    void initProcConnectsAndTables();

    List<String> getPackUrls(int procId);

    String getByJobId(Integer jobInfoId);
}
